<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resource/css/bootstrap.min.css">
	<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resource/css/jquery-confirm.css">
<script
	src="${pageContext.request.contextPath}/resource/js/jquery-1.11.1.min.js"></script>
<script
	src="${pageContext.request.contextPath}/resource/js/bootstrap.min.js"></script>
	<script
	src="${pageContext.request.contextPath}/resource/js/jquery-confirm.js"></script>
</head>
<body>
	<a target="_blank"
		href="${pageContext.request.contextPath}/muiltLang?abc=en&name=23433242&method=sbc">ajax
		请求方式</a>
	<a href="javascript:sendAjaxmaven()">ajax 请求方maven</a>
	<div id="ajaxData"></div>
	<h2 id="h2_val">创建模态框（Modal）</h2>
	<!-- 按钮触发模态框 -->
	<a class="btn btn-primary btn-lg"  href="javascript:toAddUserMes();" >   开始模态框添加用户</a>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="identifier" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content"  id="ajaxmodalCentent" >
			
			</div>
		</div>
		
		</div>
		<!-- /.modal -->
</body>

<img alt="nihaoma" src="http://img5.imgtn.bdimg.com/it/u=4117453857,418470042&fm=21&gp=0.jpg">
<script type="text/javascript">
  
  
    function sendAjaxmaven(){
         $.post("${pageContext.request.contextPath}/ajaxmethod",{name:"户晓",method:"dfs",abc:"nihao"},
      function(data){
        // alert(typeof(data));
          $("#ajaxData").append(data);
        //  alert("------"+data.name);
   } );
   }
      
      function  toAddUserMes(){
      
      $.confirm({
    title: '添加用户信息!',
    content: '你确认要添加信息吗!',
    buttons: {
        cancel: function () {
            $.alert('取消添加数据!');
        },  specialKey: {
            text: '确认添加',
            keys: ['shift', 'alt'],
            action: function(){
              $('#identifier').modal('show');
      var  loading="<strong>.........请稍等 努力加载中..........</strong>";
        $("#ajaxmodalCentent").empty().append(loading);
       $.post("${pageContext.request.contextPath}/userService/toAddUser",
      function(data){
          $("#ajaxmodalCentent").empty().append(data);
   } );
            }
        },
  
    }
});
      
    }
      
        
      function  addUserMes(){
       $.post("${pageContext.request.contextPath}/userService/addUser",{name:$("#exampleInputEmail1").val(),password:$("#exampleInputPassword1").val()},
      function(data){
			             if(data.flag==1){
			            $('#identifier').modal('hide');
			             }else{
			                alert(data.mes);
			               $('#identifier').modal('hide');
			             }
  			} );
      }


			$(document).ready(function(){
		   //  var h2value=   $("img").attr("src");
		 //    $.dialog({  title: '获--地址!',  content:$("img").attr("src"), });
		  var h2html=   $("#h2_val").html();
		  //   $.dialog({ title: '获取h2标题!',   content: h2html,});
				});
	
  </script>
</html>
